/**
 * 
 */
package ar.edu.utn.frgp.banco.servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author gvolpe
 *
 */
public abstract class GenericServlet extends HttpServlet {

	private static final long serialVersionUID = 4776846457806245600L;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		try {
			realizarAccion(req, resp);
		} catch (Exception e) {
			e.printStackTrace();
			resp.sendRedirect(req.getContextPath() +  "/errorGeneral.html");
		}
	}

	public abstract void realizarAccion(HttpServletRequest req, HttpServletResponse resp) throws Exception;

}
